<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 

<?php 
require "hrfuns.php";
Valid_Client();

?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Database Maintance</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<link rel="stylesheet" href="hr.css" />
</head>
<body>
<br />
<table cellspacing=10 cellpadding=5>
<tr><td>
<?php
$iSQL = GetSQL(false); 
?>
<form method="post" action="init_db.php">
    <legend>初始化数据库</legend>
    <table bgcolor=#c8c8c8 cellspacing=1 cellpadding=1 align="center" width=100%>
    <tr>
    <td><input type="submit" name="submit" value="初始化" />
    <td>所有的数据都会被删除！！！
    </tr>
    </table>
</form>
</td></tr>

<?php 
if ($result = $iSQL->query("use " . DBNAME)) {
?>
<tr><td>
<form enctype="multipart/form-data" method="post" action="import.php">
    <legend>导入数据</legend>
    <table bgcolor=#c8c8c8 cellspacing=1 cellpadding=1 align="center" width=100%>
    <tr>
    <td>导入的数据：</td>
    <td><select name="selTableName" class="input-list">
<?php
    $sqlstr = "select table_name, table_title from table_t order by table_id";
    if ($rsTable = $iSQL->query($sqlstr)){
        while ($row = $rsTable->fetch_assoc()) {
            echo "<option value='" . $row['table_name'] . "'>" . $row['table_title'] . "</option>\n";
        }
        $rsTable->close();
    }
?>
    </select></td>
 
    <td>文件：</td>
    <td><input type="file" name="txtFile" size=12/></td>
    <td><input type="submit" name="submit" value="导入" /></td>
    </tr>
    </table>
</form>
</td></tr>

<tr><td>
<form method="post" action="dump.php">
    <legend>导出数据</legend>
    <table bgcolor=#c8c8c8 cellspacing=1 cellpadding=1 align="center" width=100%>
    <tr>
    <td>选择数据源：</td>
    <td><select name="selTableName" class="input-list">
<?php
    $sqlstr = "select table_name, table_title from table_t order by table_id";
    if ($rsTable = $iSQL->query($sqlstr)){
        while ($row = $rsTable->fetch_assoc()) {
            echo "<option value='" . $row['table_name'] . "'>" . $row['table_title'] . "</option>\n";
        }
        $rsTable->close();
    }
?>
    </select></td>
    <td><input type="submit" name="submit" value="导出" /></td>
    </tr>
    </table>
</form>
</td></tr>
<?php } ?>
</table>
</body>
</html>
